package com.mccken.designpattern.strategy.strategy_03.sub_srategy;

import com.mccken.designpattern.strategy.strategy_03.IPromotionStrategy;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2024-01-14 20:19
 **/
public class CouponStrategy implements IPromotionStrategy {

	@Override
	public double doPromotion(double price) {
		System.out.println("使用优惠券抵扣");
		return Double.max(0, price - getCoupon());
	}
	
	private double getCoupon() {
		double coupon = 5.0;
		System.out.println("查询到优惠券" + coupon + "元");
		return coupon;
	}
}
